package com.orhon.smartcampus.modules.baseinfo.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import java.util.Date;
import java.sql.Timestamp;

@Setter
@Getter
@EqualsAndHashCode
@Entity
@Table(name = "baseinfo_schoolcalendar_day", schema = "smartcloud", catalog = "")
public class SchoolcalendarDay {
    
	@Id
    @Column(name = "id", nullable = false)
    @GeneratedValue
	private Long id;
    
    @Column(name = "school_id", nullable = true)
    private Long schoolId;
    
    @Column(name = "year_code", nullable = true, length = 32)
    private String yearCode;
    
    @Column(name = "year", nullable = false)
    private Integer year;
    
    @Column(name = "month", nullable = false, length = 120)
    private String month;
    
    @Column(name = "day", nullable = false, length = 120)
    private String day;
    
    @Column(name = "specificdate", nullable = true)
    private Date specificdate;
    
    @Column(name = "type", nullable = false, length = 32)
    private String type;
    
    @Column(name = "day_sort", nullable = true)
    private Integer daySort;
    
    @Column(name = "week_number", nullable = true)
    private Integer weekNumber;
    
//    @Column(name = "week_id", nullable = true)
//    private Integer weekId;
    
    @Column(name = "name", nullable = true)
    private String name;
    
    @Column(name = "created_at", nullable = true)
    private Date createdAt;
    
    @Column(name = "updated_at", nullable = true)
    private Date updatedAt;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @Where(clause = "ISNULL(deleted_at)")
    @JoinColumn(name = "semester_id", referencedColumnName = "id")
    @NotFound(action=NotFoundAction.IGNORE)
    private Semester semester;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "week_id", referencedColumnName = "id")
    @NotFound(action=NotFoundAction.IGNORE)
    private SchoolcalendarWeek schoolcalendarWeek;


}
